package com.xiaomazi.edu.controller;

import com.xiaomazi.common.utils.R;
import com.xiaomazi.edu.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @program: llxy-parent
 * @description: 课程分类前端控制器
 * @author: 小马子
 * @create: 2023-02-14 17:15
 **/
@RestController
@RequestMapping("/eduservice/subject")
public class SubjectController {

    @Autowired
    private SubjectService subjectService;

    @PostMapping("/save")
    public R saveSubjectByExcel(MultipartFile excelFile){
        return subjectService.saveSubjectByExcel(excelFile);
    }

    /**
     * 课程分类列表（树形）
     * @return list
     */
    @GetMapping("/getAllSubject")
    public R getAllSubject(){
        return subjectService.getAllSubject();
    }




}
